package com.fingard.dsp.bank.reqrespobj.exchangerate;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.dsp.bank.reqrespobj.exchangerate.detail.ReqExchangeRateDetail;
import com.fingard.xml.XmlTextReader;


public class ReqExchangeRateQry extends RequestBase {

    private XmlTextReader xmlReader;
    public ReqExchangeRateDetail readedDetail;
    public int detailCount = -1;
    public boolean isBatch = false;
    public ReqExchangeRateQry(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception{
        reqHeader = p_header;
        xmlReader = p_xmlReader;
        detailCount = xmlReader.countElement(PATH_Detail);
        if (detailCount > 0) {
            isBatch = true;
        } else {
            isBatch = false;
            detailCount = 1;
        }
    }
    public boolean readRecord() throws Exception{
        readedDetail = null;
        if(xmlReader.read(PATH_Detail)){
            readedDetail = new ReqExchangeRateDetail(xmlReader.readedXElement);
            return true;
        }
        else{
            return false;
        }
    }

    public String getOriReqXml(){
        return xmlReader.getOriXmlString();
    }
}
